package cn.icanci.service.solo.impl;

import cn.icanci.entity.bo.HeadLine;
import cn.icanci.entity.dto.Result;
import cn.icanci.service.solo.HeadLineService;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.List;

import org.simpleframework.core.annotation.Service;

/**
 * 头条列表实现类
 *
 * @author icanci
 * @date Created in 2021/02/03 23:21
 * @version 1.0
 */
@Slf4j
@Service
public class HeadLineServiceImpl implements HeadLineService {
    @Override
    public Result<Boolean> addHeadLine(HeadLine headLine) {
        log.info("addHeadLine 被执行了，lineName:[{}],lineLink:[{}],lineImg:[{}],priority:[{}]", headLine.getLineName(), headLine.getLineLink(), headLine.getLineImg(),
            headLine.getPriority());
        Result<Boolean> booleanResult = new Result<>();
        booleanResult.setCode(200);
        booleanResult.setData(true);
        booleanResult.setMsg("保存成功");
        return booleanResult;
    }

    @Override
    public Result<Boolean> removeHeadLineById(int headLineId) {
        return null;
    }

    @Override
    public Result<Boolean> modifyHeadLine(HeadLine headLine) {
        return null;
    }

    @Override
    public Result<HeadLine> queryHeadLineById(int headLinedId) {
        return null;
    }

    @Override
    public Result<List<HeadLine>> queryHeadLine(HeadLine headLineCondition, int pageIndex, int pageSize) {
        List<HeadLine> headLines = new ArrayList<>();
        for (int i = 0; i < 3; i++) {
            HeadLine headLine = new HeadLine();
            headLine.setHeadId(1L);
            headLine.setLineLink("http://icanci.cn/hhh.img");
            headLine.setLineName("hello ketty");
            headLines.add(headLine);
        }
        Result<List<HeadLine>> headLineResult = new Result<>();
        headLineResult.setData(headLines);
        headLineResult.setCode(200);
        return headLineResult;
    }
}
